package maosy.oauth2.password.util

import org.springframework.http.ResponseEntity
import org.springframework.util.MultiValueMap
import org.springframework.http.HttpStatus as HttpStatus1

class HttpEntityUtil<T> : ResponseEntity<T> {
    constructor(status: HttpStatus1) : super(status)
    constructor(body: T?, status: HttpStatus1) : super(body, status)
    constructor(headers: MultiValueMap<String, String>, status: HttpStatus1) : super(headers, status)
    constructor(body: T?, headers: MultiValueMap<String, String>?, status: HttpStatus1) : super(body, headers, status)

    companion object
}



fun <T> HttpEntityUtil.Companion.isOk(body: T?): HttpEntityUtil<T> =
    HttpEntityUtil(body, null, HttpStatus1.OK)

fun <T> HttpEntityUtil.Companion.isFail(body: T?): HttpEntityUtil<T> =
    HttpEntityUtil(body, null, HttpStatus1.INTERNAL_SERVER_ERROR)


